package com.scores.service.impl;

import com.scores.mapper.TeacherMapper;
import com.scores.pojo.Teacher;
import com.scores.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {

    @Autowired
    TeacherMapper teacherMapper;

    @Override
    public List<Teacher> getAllTeachers(Teacher teacher) {
        return teacherMapper.getAllTeachers(teacher);
    }

    @Override
    public int updatePassword(int teacherId, String newPassword) {
        int count = teacherMapper.updatePassword(teacherId, newPassword);
        if(count > 0) {
            return 0; // Success
        } else {
            return 1; // Failure
        }
    }


}
